﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using VisionarySystems.TimeRegi.Controller;
using VisionarySystems.TimeRegi.Model;
using VisionarySystems.TimeRegi.Model.TimePeriods;

namespace VisionarySystems.TimeRegi
{
    static class Program
    {
	    private static Form_TimeRegistration m_FormTimeRegistration;

	    /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
		    Application.Run(InitApplication());
        }

		private static Form_TimeRegistration InitApplication()
	    {
			// Create model
		    var model = new TimePeriodModel();
		    var viewModel = new TimeRegistrationViewModel(model);
			
			// Create controller 
		    var controller = new TimeRegistrationController(viewModel);

			//Create View + controller
			var view = new Form_TimeRegistration(controller, viewModel);

			// Let View subscribe to Viewmodel
			viewModel.TimeSlotsChanged += view.OnTimeSlotChanged;
			
			return view;
	    }
    }
}
